﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace SCOSub
{
    public partial class VisualStaffMaker_TextBox : Form
    {
        string filename;
        
        public VisualStaffMaker_TextBox(string filename)
        {
            InitializeComponent();
            this.filename = filename;
            OpenFile();
        }

        private void richTextBox1_TextChanged(object sender, EventArgs e)
        {
           // SaveFile(); 
        }
        private void OpenFile()
        {
            StreamReader sr = new StreamReader(filename, Encoding.Unicode);
            richTextBox1.Text = sr.ReadToEnd();
            sr.Dispose();
        }
        private void SaveFile()
        {
            StreamWriter sw = new StreamWriter(filename, true, Encoding.Unicode);
            sw.WriteLine(richTextBox1.Text);
            sw.Dispose();
        }
    }
}
